package com.itany.corejava.code07_面向对象;

/**
 * @author 石小俊
 * @date 2023年04月17日 16:47
 */
public class Test05_方法重载 {
    public static void main(String[] args) {
        Calculator calculator = new Calculator();
        int sum = calculator.sum(1, 2);
        System.out.println(sum);
        System.out.println("*************************");
        double sum2 = calculator.sum(3.14, 5.12);
        System.out.println(sum2);
    }


}

class Calculator {
    public int sum(int i, int j) {
        System.out.println("int类型的求和");
        return i + j;
    }

    public double sum(double i, double j) {
        System.out.println("double类型的求和");
        return i + j;
    }

    public double sum(int i, double j) {
        return i + j;
    }

    public double sum(double j, int i) {
        return i + j;
    }

    public int sum(int i, int j, int k) {
        return i + j + k;
    }

}
